import normalRequest from 'supports/requests/normalRequest'
import authRequest from 'supports/requests/authRequest'


export function login(data) {
  return normalRequest('distribution/auth', {method: 'post', data: data})
}

export function register(data) {
  return normalRequest('distribution/register', {method: 'post', data: data})
}

export function resetPassword(data) {
  return normalRequest('passwords/reset', {method: 'put', data: data})
}

export function verifyPassword(data) {
  return normalRequest('passwords/verify', {method: 'post', data: data})
}

export function getCapchaBeforeSms(data) {
  return normalRequest('captchas', {method: 'post', data: data})
}

export function setPayCode(data) {
  return authRequest('passwords/set/pay/code', {method: 'put', data: data})
}

export function sendingSmsCode(data) {
  return normalRequest('sms/code', {method: 'post', data: data})
}


export function gettingPhone(data) {
  return normalRequest('auth/wxmini/phone', {method: 'post', data: data})
}

export function refresh(token) {
  return normalRequest('auth/token', {method: 'put', header: {'Authorization': 'Bearer ' + token}})
}

export function logout(token) {
  return normalRequest('auth/token', {method: 'delete', header: {Authorization: 'Bearer ' + token}})
}
